/***************************************************************
*  Copyright (c) 2007 by GroupMe! Team (www.groupme.net)
*  All rights reserved.
*
*  This file is part of the GroupMe! Project. Source code of 
*  this project is closed and redistribution of this code is
*  prohibited. 
*  
*  Contact: http://www.groupme.net
*
*  This copyright notice MUST APPEAR in all copies of the file!
***************************************************************/
package net.groupme.gui.rendering;

import java.util.Iterator;
import java.util.List;

import net.groupme.model.ObjectFactory;
import net.groupme.model.Resource;
import net.groupme.model.rdf.Statement;

/**
 * created on Jul 12, 2007
 * 
 * This class provides some functionality to render a {@link Resource} in more detail.
 * For example it renders the metadata of a resource, etc.
 * 
 * @author Fabian Abel, <a href="mailto:abel@l3s.de">abel@l3s.de</a>
 * @author last edited by: $Author: fabian $
 * 
 * @version $Revision: 1.2 $ $Date: 2007-07-12 11:30:38 $
 */
public class BigResourceRenderingUtility {

	/**
	 * Returns the detail content for a BRV for a Resource.
	 * @param resourceId the ID of the Resource
	 * @param resVisuURI the URI of the ResourceVisualization
	 * @return the detail content as HTML
	 */
	public static final String getResourceDetailsView(String resourceId){
		Resource resource = ObjectFactory.getResource(resourceId);
		
		List<Statement> metadata = (List<Statement>) resource.getStatements();
		String html = "";
		html += "<div id=\"BRVDetails\">";
		html +=	"<strong>Details of Resource " + resource.getName() + ":</strong><br/><br/>" +
				"Description: " +
				"<div id=\"BRVDescription\">" + resource.getDescription() + "</div><br/>" +
				"Tags: " +
				"<div id=\"BRVTags\">";
		
		TagRenderer tagRenderer = new TagRenderer();
		String tags = tagRenderer.renderTagsAsHtmlString(resource.getTags());
		html += tags;
		
		html +=	"</div><br/>" +
				"Additional metadata: " +
				"<div id=\"BRVMetadata\">";
		int count = 1;
		for (Iterator iter = metadata.iterator(); iter.hasNext();) {
			Statement element = (Statement) iter.next();
			html += "<strong>Statement " + count + ": </strong><br/>";
			html += "Subject: " + element.getSubject().getURI() + "<br/>" +
					"Property: " + element.getProperty() + "<br/>" +
					"Object: " + element.getObject() + "<br/></br>";
			count++;
		}
		html += "</div>";
		html += "</div>";
		return html;
	}
}
